<style lang="less">
    @import '../../styles/common.less';
</style>

<template>
    <div>
		
		<Card :bordered="false" >
			<Steps :current="steps.index">
				<Step :title="steps.title[0]"></Step>
				<Step :title="steps.title[1]"></Step>
				<Step :title="steps.title[2]"></Step>
			</Steps>
		</Card>
		
		<Alert  show-icon  >
			状态
			<span slot="desc" v-html="steps.content"></span>
		</Alert>
		
		
		
       <Card :bordered="false">
		   <p slot="title">商户基础信息</p>
		   <div class="inpBox">
			   
			   <div>
				   <span>商户全称：</span>
				   <Input  placeholder="请输入..." style="width: 300px"  v-model="msgData.merchantName"></Input>
			   </div>
			   
			   <div>
				   <span>商户类型：</span>

					
					<Select style="width:200px" v-model="init.merchantType"  @on-change="chantTypechange" label-in-value >
							<Option v-for="(item,index) in chantType" :value="index"  >{{item}}</Option>
					</Select>
			   </div>
			   
			   <div>
				   <span>分类：</span>
				   <Select style="width:200px" v-model="init.mccCate1" @on-change="mccChange" label-in-value >
					   <Option v-for="item in mccData.mccCodes" :value="item.mccCodeId"  >{{item.cate}}</Option>
				   </Select>
				   
				  <Select style="width:200px"  v-model="init.mccCate2" @on-change="mccChange2" label-in-value >
				  		<Option v-for="item in mccData.mccCodes2" :value="item.mccCodeId"  >{{item.cate}}</Option>
				  </Select>
				  
				  <Select style="width:200px" v-model="init.mccCate3" @on-change="mccChange3" label-in-value >
				  		<Option v-for="item in mccData.mccCodes3" :value="item.mccCodeId"  >{{item.cate}}</Option>
				  </Select>
				  
				  <Select style="width:200px" v-model="init.mccCate4" @on-change="mccChange4" label-in-value >
				  		<Option v-for="item in mccData.mccCodes4" :value="item.mccCodeId"  >{{item.cate}}</Option>
				  </Select>
				  
			   </div>
			   

			   
			   <div>
				   <span>商户简称：</span>
				   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.merchantShortName"></Input>
			   </div>

		   </div>
	   </Card>
	   
	   <Card :bordered="false">
	   		   <p slot="title">法人信息</p>
	   		   <div class="inpBox">
	   			   
	   			   <div>
	   				   <span>法人姓名：</span>
	   				   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.legalName"></Input>
	   			   </div>
	   			   
	   			   <div>
	   				   <span>证件号码：</span>
	   				   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.idCardNo"></Input>
	   			   </div>
	   			   
	   			   <div>
					   <span style="display: block;">
						   证件正面照
					   </span>
						    <div class="demo-upload-list" v-if="upImg.img[0]">
						        <template >
						            <img :src="upImg.img[0]">
						            <div class="demo-upload-list-cover">
						                <Icon type="ios-eye-outline" @click.native="handleView(upImg.img[0])"></Icon>
						                <Icon type="ios-trash-outline" @click.native="handleRemove('img')"></Icon>
						            </div>
						        </template>

						    </div>
						    <Upload
						        ref="upload"
						        :show-upload-list="false"
						        :on-success="handleSuccess"
						        :format="['jpg','jpeg','png']"
						        :max-size="2048"
						        type="drag"
								:action="upUrl"
						        style="display: inline-block;width:58px;">
						        <div style="width: 58px;height:58px;line-height: 58px;">
						            <Icon type="camera" size="20"></Icon>
						        </div>
						    </Upload>
	   			   </div>
						
	   			   <div>
					   <span style="display: block;">
					   			证件背面照
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img2[0]">
					       <template >
					           <img :src="upImg.img2[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img2[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img2')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess2"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					   					       
	   				  
	   			   </div>
				   
				   <div >
					   <span>请证件的有效期：</span>
					   <Input  placeholder="开始日期 2000-20-20" style="width: 300px" v-model="msgData.idCardStart"></Input>
					   <Input  placeholder="结束日期 2002-20-20" style="width: 300px" v-model="msgData.idCardEnd"></Input>
				   </div>
	   
	   		   </div>
	   </Card>
	   
	   <Card :bordered="false">
	   		   <p slot="title">联系人信息</p>
	   		   <div class="inpBox">
	   			   
	   			   <div>
	   				   <span>联系人姓名：</span>
	   				   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.name"></Input>
	   			   </div>
				   
				   <div>
					   <span>联系人电话：</span>
					   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.mobile"></Input>
				   </div>
	   			   
				</div>
	   </Card>
	   
	   <Card :bordered="false">
		   <p slot="title">商户地址信息</p>
		   <div class="inpBox">
			   <div>
				   <span>省份：</span>
					<Select style="width:200px" v-model="init.province" @on-change="leshuaAreaChange" label-in-value>
						<Option v-for="item in leshuaAreaData.leshuaArea"
						:value="item.areaCode"  
						>{{item.areaName}}</Option>
					</Select>
					<span>城市：</span>
					<Select style="width:200px" v-model="init.city" @on-change="leshuaAreaChange2" label-in-value>
						<Option v-for="item in leshuaAreaData.leshuaArea2"
						:value="item.areaCode"  
						>{{item.areaName}}</Option>
					</Select>
					<span>区/县：</span>
					<Select style="width:200px" v-model="init.area" @on-change="leshuaAreaChange3" label-in-value>
						<Option v-for="item in leshuaAreaData.leshuaArea3"
						:value="item.areaCode"  
						>{{item.areaName}}</Option>
					</Select>
			   </div>
			   
			   
			   <div>
				   <span>详细地址：</span>
				   <Input  placeholder="请输入....." style="width: 300px" v-model="msgData.address"></Input>
			   </div>
			   
			</div>
	   </Card>
	   
	   <Card :bordered="false"  v-if="isbusiness">
	   		   <p slot="title">商户营业资质信息</p>
	   		   <div class="inpBox">
	   			   <div>
					   <span>税号：</span>
						<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.license"></Input>
	   			   </div>
	   				<div>
						<span>公司全称：</span>
						<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.licenseFullName"></Input>
	   				</div>
	   				<div>
	   					<span>公司注册地址：</span>
	   					<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.licenseAddress"></Input>
	   				</div>
					
					<div>
					   <span>公司有效期：</span>
					   <Input  placeholder="注册日期 2000-20-20" style="width: 300px" v-model="msgData.licenseStart"></Input>
					   <Input  placeholder="到期日期 2002-20-20" style="width: 300px" v-model="msgData.licenseEnd"></Input>
					</div>
					
					<div>

					   <span style="display: block;">
					   			营业执照
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img3[0]">
					       <template >
					           <img :src="upImg.img3[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img3[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img3')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess3"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					</div>
	   			</div>
	   </Card>
	   
	   <Card :bordered="false">
	   		   <p slot="title">商户结算账号信息</p>
	   		   <div class="inpBox">
	   			   <div>
					   <span>账号类型：</span>

						
						<Select style="width:200px" v-model="init.typeData"  @on-change="typeChange" label-in-value >
								<Option v-for="(item,index) in typeData" :value="index"  >{{item}}</Option>
						</Select>
						
	   			   </div>
				   
				   
				   <div>
					   <span>结算类型：</span>
   
						
						<Select style="width:200px" v-model="init.legalFlag"  @on-change="FlagtypeChange" label-in-value >
								<Option v-for="(item,index) in legalFlag" :value="index"  >{{item}}</Option>
						</Select>
				   				
								
						<div v-if="msgData.legalFlag == 0">
								<div>
								   <span style="display: block;">
								   		法人结算授权书
					<Button type="primary" shape="circle" size="small" @click="downloadBook(1)">授权书下载</Button>
					<Button type="primary" shape="circle" size="small" @click="downloadBook(2)">企业模板下载</Button>
					<Button type="primary" shape="circle" size="small" @click="downloadBook(3)">个人模板下载</Button>
								   </span>
								   <div class="demo-upload-list" v-if="upImg.img8[0]">
								       <template >
								           <img :src="upImg.img8[0]">
								           <div class="demo-upload-list-cover">
								               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img8[0])"></Icon>
								               <Icon type="ios-trash-outline" @click.native="handleRemove('img8')"></Icon>
								           </div>
								       </template>
								   
								   </div>
								   <Upload
								       ref="upload"
								       :show-upload-list="false"
								       :on-success="handleSuccess8"
								       :format="['jpg','jpeg','png']"
								       :max-size="2048"
								       type="drag"
								   	:action="upUrl"
								       style="display: inline-block;width:58px;">
								       <div style="width: 58px;height:58px;line-height: 58px;">
								           <Icon type="camera" size="20"></Icon>
								       </div>
								   </Upload>
								   
								   
								</div>
								
								<div>
								   <span style="display: block;">
								   		非法人身份证正面
								   </span>
								   <div class="demo-upload-list" v-if="upImg.img9[0]">
								       <template >
								           <img :src="upImg.img9[0]">
								           <div class="demo-upload-list-cover">
								               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img9[0])"></Icon>
								               <Icon type="ios-trash-outline" @click.native="handleRemove('img9')"></Icon>
								           </div>
								       </template>
								   
								   </div>
								   <Upload
								       ref="upload"
								       :show-upload-list="false"
								       :on-success="handleSuccess9"
								       :format="['jpg','jpeg','png']"
								       :max-size="2048"
								       type="drag"
								   	:action="upUrl"
								       style="display: inline-block;width:58px;">
								       <div style="width: 58px;height:58px;line-height: 58px;">
								           <Icon type="camera" size="20"></Icon>
								       </div>
								   </Upload>
								   
								</div>
								
								<div>
								   <span style="display: block;">
								   		非法人身份证反面
								   </span>
								   <div class="demo-upload-list" v-if="upImg.img10[0]">
								       <template >
								           <img :src="upImg.img10[0]">
								           <div class="demo-upload-list-cover">
								               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img10[0])"></Icon>
								               <Icon type="ios-trash-outline" @click.native="handleRemove('img10')"></Icon>
								           </div>
								       </template>
								   
								   </div>
								   <Upload
								       ref="upload"
								       :show-upload-list="false"
								       :on-success="handleSuccess10"
								       :format="['jpg','jpeg','png']"
								       :max-size="2048"
								       type="drag"
								   	:action="upUrl"
								       style="display: inline-block;width:58px;">
								       <div style="width: 58px;height:58px;line-height: 58px;">
								           <Icon type="camera" size="20"></Icon>
								       </div>
								   </Upload>
								   
								</div>
						</div>
				   </div>
				   
					
					<div>
					   <span>开户支行：</span>
					   
						<Select style="width:200px" @on-change="searchUnionPayChange" v-model="init.unionProvince" label-in-value>
							<Option v-for="item in searchUnionPayData.searchUnionPay"
							:value="item.areaCode"  
							>{{item.areaName}}</Option>
						</Select>
						
						<Select style="width:200px" @on-change="searchUnionPayChange2" v-model="init.unionCity" label-in-value>
							<Option v-for="item in searchUnionPayData.searchUnionPay2"
							:value="item.areaCode"  
							>{{item.areaName}}</Option>
						</Select>
						
						<Select style="width:300px" @on-change="searchUnionPayChange3" v-model="init.unionPay" label-in-value filterable>
							<Option v-for="item in searchUnionPayData.searchUnionPay3"
							:value="item.unionPay"  
							>{{item.title}}</Option>
						</Select>
					</div>
					
					<div>
					    <span>银行卡号：</span>
						<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.bankCardNo"></Input>
					</div>
					
					<div>
					   <span style="display: block;">
					   						   证件正面照
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img4[0]">
					       <template >
					           <img :src="upImg.img4[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img4[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img4')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess4"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					   
					</div>
					
					<div>
					    <span>开户名：</span>
						<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.holder"></Input>
					</div>
					
					<div>
					    <span>身份证号码：</span>
						<Input  placeholder="请输入....." style="width: 300px" v-model="msgData.idCardNo"></Input>
					</div>
					
	   			</div>
	   </Card>
	   
	   <Card :bordered="false">
	   		   <p slot="title">商户店铺信息</p>
	   		    <div class="inpBox">
					<div>
					   <span style="display: block;">
					   			经营场所内照片
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img5[0]">
					       <template >
					           <img :src="upImg.img5[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img5[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img5')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess5"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					   
					</div>
					<div>

					   <span style="display: block;">
					   			门头照
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img6[0]">
					       <template >
					           <img :src="upImg.img6[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img6[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img6')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess6"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					</div>
					<div>
					   
					   
					   <span style="display: block;">
					   			收银台照片
					   </span>
					   <div class="demo-upload-list" v-if="upImg.img7[0]">
					       <template >
					           <img :src="upImg.img7[0]">
					           <div class="demo-upload-list-cover">
					               <Icon type="ios-eye-outline" @click.native="handleView(upImg.img7[0])"></Icon>
					               <Icon type="ios-trash-outline" @click.native="handleRemove('img7')"></Icon>
					           </div>
					       </template>
					   
					   </div>
					   <Upload
					       ref="upload"
					       :show-upload-list="false"
					       :on-success="handleSuccess7"
					       :format="['jpg','jpeg','png']"
					       :max-size="2048"
					       type="drag"
					   	:action="upUrl"
					       style="display: inline-block;width:58px;">
					       <div style="width: 58px;height:58px;line-height: 58px;">
					           <Icon type="camera" size="20"></Icon>
					       </div>
					   </Upload>
					   	
					</div>
				</div>
	   </Card>
	   
	   
	   <Card :bordered="false" >
			<Button type="info" @click="Submit" v-if="isbtn">提交</Button>
			<Button type="info" @click="update" v-if="isupdate">更新</Button>
	   </Card>

	   
	   <Modal title="查看图片" v-model="visible">
	       <img :src="img" v-if="visible" style="width: 100%">
	   </Modal>
    </div>
</template>

<script>
export default {
    data () {
        return {
            visible:false,
			msgData:{},
			mccData:{
				mccCodes:[],
				mccCodes2:[],
				mccCodes3:[],
				mccCodes4:[],
			},
			leshuaAreaData:{
				leshuaArea:[],
				leshuaArea2:[],
				leshuaArea3:[]
			},
			searchUnionPayData:{
				searchUnionPay:[],
				searchUnionPay2:[],
				searchUnionPay3:[],
				province:""
			},
			upUrl:this.$http.defaults.baseURL+'merchant/uploadLeshuaMediaFile?tokenId='+this.common.getObject('MERCHANTTOKEN'),
			upImg:{
				img:[],
				img2:[],
				img3:[],
				img4:[],
				img5:[],
				img6:[],
				img7:[],
				img8:[],
				img9:[],
				img10:[],
			},
			img:"",
			typeData:["个人","个体户","企业"],
			chantType:["个人","个体户","企业"],
			legalFlag:["非法人结算","法人结算"],
			init:{
				merchantType:"",
				typeData:"",
				province:"",
				city:"",
				area:"",
				mccCate1:"",
				mccCate2:"",
				mccCate3:"",
				mccCate4:"",
				unionProvince:"",
				unionCity:"",
				unionPay:"",
				legalFlag:""
			},
			isbusiness:false,
			steps:{
				index:0,
				content:"申请中",
				title:["填写资料","人工审核","审核通过"]
			},
			isbtn:true,
			isupdate:false,
			booK:[
				"https://shiru.oss-cn-shenzhen.aliyuncs.com/file/%E9%9D%9E%E6%B3%95%E4%BA%BA%E7%BB%93%E7%AE%97%E7%A1%AE%E8%AE%A4%E4%B9%A6.pdf",
				"https://shiru.oss-cn-shenzhen.aliyuncs.com/file/%E7%BB%93%E7%AE%97%E7%A1%AE%E8%AE%A4%E4%B9%A6--%E4%BC%81%E4%B8%9A%E6%B3%95%E4%BA%BA%E5%A1%AB%E5%86%99%E6%A8%A1%E6%9D%BF.pdf",
				"https://shiru.oss-cn-shenzhen.aliyuncs.com/file/%E7%BB%93%E7%AE%97%E7%A1%AE%E8%AE%A4%E4%B9%A6--%E4%B8%AA%E4%BD%93%E5%B7%A5%E5%95%86%E6%88%B7%E5%A1%AB%E5%86%99%E6%A8%A1%E6%9D%BF.pdf"
			]
        }
    },
    methods: {
		//获取mcc分类
        searchMccCate(level,parentId){
			var config={};
			config.level=level;
			if(parentId){
				config.parentId=parentId;
			}
            this.$http.post("/merchant/searchMccCate", this.common.request(config))  
            .then(response => {
				if(level == 1){
					this.mccData.mccCodes=response.data.body.data.mccCodes;
				}else if(level == 2){
					this.mccData.mccCodes2=response.data.body.data.mccCodes;
				}else if(level == 3){
					this.mccData.mccCodes3=response.data.body.data.mccCodes;
				}else if(level == 4){
					this.mccData.mccCodes4=response.data.body.data.mccCodes;
				}
				
            }, response => {  
                this.$Message.error(response.data.body.status.errorDesc);
            })
			
        },
		mccChange(msg){
			this.msgData.mccCate1=msg.value;
			this.searchMccCate(2,msg.value);
		},
		mccChange2(msg){
			this.msgData.mccCate2=msg.value;
			this.searchMccCate(3,msg.value);
		},
		mccChange3(msg){
			this.msgData.mccCate3=msg.value;
			this.searchMccCate(4,msg.value);
		},
		mccChange4(msg){
			this.msgData.mccCate4=msg.value;
			for(var i=0;i<this.mccData.mccCodes4.length;i++){
				if(this.mccData.mccCodes4[i].mccCodeId ==msg.value)
				this.msgData.mccCode=this.mccData.mccCodes4[i].mccCode;
			}
			
		},
		//获取地区
		leshuaArea(index,parentAreaCode,type){
			var config={};
			if(parentAreaCode){
				config.parentAreaCode=parentAreaCode;
			}
			this.$http.post("/merchant/leshuaArea", this.common.request(config))  
			.then(res => {
				
				if(!type){
					if(index == 1){
						this.leshuaAreaData.leshuaArea=res.data.body.data.areas
					}else if(index == 2){
						this.leshuaAreaData.leshuaArea2=res.data.body.data.areas
					}else if(index == 3){
						this.leshuaAreaData.leshuaArea3=res.data.body.data.areas
					}
				}else{
					if(index == 1){
						this.searchUnionPayData.searchUnionPay=res.data.body.data.areas
					}else {
						this.searchUnionPayData.searchUnionPay2=res.data.body.data.areas
					}
				}
				
			}, response => {  
			    this.$Message.error(response.data.body.status.errorDesc);
			})
		},
		leshuaAreaChange(e){
			this.msgData.province=e.label;
			this.msgData.provinceCode=e.value;
			this.searchUnionPayData.searchUnionPay2=[];
			this.leshuaAreaData.leshuaArea2=[];
			this.leshuaArea(2,e.value)
		},
		leshuaAreaChange2(e){
			this.msgData.city=e.label;
			this.msgData.cityCode=e.value;
			this.leshuaAreaData.leshuaArea3=[];
			this.leshuaArea(3,e.value)
		},
		leshuaAreaChange3(e){
			this.msgData.area=e.label;
			this.msgData.areaCode=e.value;
		},
		//获取联行号
		searchUnionPay(province,city){
			this.$http.post("/merchant/searchUnionPay", this.common.request({province,city})).then((res)=>{
				this.searchUnionPayData.searchUnionPay3=res.data.body.data.unionPays;
			});
		},
		searchUnionPayChange(e){
			this.msgData.unionProvince=e.value;
			this.leshuaArea(2,e.value,1);
			this.searchUnionPayData.province=e.label;
		},
		searchUnionPayChange2(e){
			this.msgData.unionCity=e.value;
			// console.log(this.searchUnionPayData.province)
			this.searchUnionPay(this.searchUnionPayData.province,e.label);
		},
		searchUnionPayChange3(e){
			this.msgData.unionPay=e.value;
		},
		handleView(e){
			this.img=e;
			this.visible=true;
		},
		handleRemove(e){
			this.upImg[e]="";
		},
		handleSuccess(e){
			this.upImg.img=e.data[0].split('|');
			this.msgData.idCardFrontPicUrl=this.upImg.img[0]
			this.msgData.idCardFrontPic=this.upImg.img[1]
		},
		handleSuccess2(e){
			this.upImg.img2=e.data[0].split('|');
			this.msgData.idCardBackPicUrl=this.upImg.img2[0]
			this.msgData.idCardBackPic=this.upImg.img2[1]
		},
		handleSuccess3(e){
			this.upImg.img3=e.data[0].split('|');
			this.msgData.licensePicUrl=this.upImg.img3[0]
			this.msgData.licensePic=this.upImg.img3[1]
		},
		handleSuccess4(e){
			this.upImg.img4=e.data[0].split('|');
			this.msgData.bankCardFrontPicUrl=this.upImg.img4[0]
			this.msgData.bankCardFrontPic=this.upImg.img4[1]
		},
		handleSuccess5(e){
			this.upImg.img5=e.data[0].split('|');
			this.msgData.insidePicUrl=this.upImg.img5[0]
			this.msgData.insidePic=this.upImg.img5[1]
		},
		handleSuccess6(e){
			this.upImg.img6=e.data[0].split('|');
			this.msgData.doorPicUrl=this.upImg.img6[0]
			this.msgData.doorPic=this.upImg.img6[1]
		},
		handleSuccess7(e){
			this.upImg.img7=e.data[0].split('|');
			this.msgData.cashierDeskPicUrl=this.upImg.img7[0]
			this.msgData.cashierDeskPic=this.upImg.img7[1]
		},
		handleSuccess8(e){
			this.upImg.img8=e.data[0].split('|');
			this.msgData.nonLegSettleAuthPicUrl=this.upImg.img8[0]
			this.msgData.nonLegSettleAuthPic=this.upImg.img8[1]
		},
		handleSuccess9(e){
			this.upImg.img9=e.data[0].split('|');
			this.msgData.nonLegIdcardFrontPicUrl=this.upImg.img9[0]
			this.msgData.nonLegIdcardFrontPic=this.upImg.img9[1]
		},
		handleSuccess10(e){
			this.upImg.img10=e.data[0].split('|');
			this.msgData.nonLegIdcardBackPicUrl=this.upImg.img10[0]
			this.msgData.nonLegIdcardBackPic=this.upImg.img10[1]
		},
		typeChange(e){
			
			this.msgData.accountType=e.value+1;
		},
		FlagtypeChange(e){
			this.msgData.legalFlag=e.value+"";
			// console.log(this.msgData.legalFlag)
		},
		chantTypechange(e){
			console.log(e)
			if(e.value+1 != 1){
				this.isbusiness=true;
			}else{
				this.isbusiness=false;
			}
			this.msgData.merchantType=e.value+1;
		},
		//判断是否申请  申请状态
		isType(){
			var merchantUuid=this.$store.state.user.merchantUuid;
			// var merchantUuid=this.common.getObject('MERCHANTUUID');
			this.$http.post("/merchant/inquiryInfo", this.common.request({merchantUuid})).then((res)=>{
				console.log(res.data.body)
				if(!res.data.body.data){
					this.steps.index=0;
					console.log("未申请过")
					this.steps.index=0;
					this.steps.content="待申请"
					
					
				}else{
					this.isbtn=false;
					console.log("已申请")
					// console.log(res.data.body.data.auditStatus)
					switch(res.data.body.data.auditStatus){
						case "UNKNOWN":
							console.log("未知")
							this.steps.index=1;
							this.steps.title[1]="未知"
							this.steps.content=res.data.body.data.auditMsg;
							this.isupdate=true;
						break;
						case "ADD_INFO":
							console.log("待完善资料")
							this.steps.index=1;
							this.steps.title[1]="待完善资料"
							this.steps.content=res.data.body.data.auditMsg;
							this.isupdate=true;
						break;
						case "AUDITING":
							console.log("待审核")
							this.steps.index=1;
							
						break;
						case "REJECTED":
							console.log("退回")
							this.steps.index=1;
							this.steps.title[1]="退回"
							this.steps.content=res.data.body.data.auditMsg;
							this.isupdate=true;
						break;
						case "REVIEW":
							console.log("待人工检查")
							this.steps.index=1;
							this.steps.title[1]="待人工检查"
							
						break;
						case "PASSED":
							console.log("通过")
							this.steps.index=3;
							this.steps.content=res.data.body.data.auditMsg;
							this.isupdate=true;
						break;
					}
					
					
					this.isupdate=true;
					
					this.initData(res.data.body.data)
				}
			})
		},
		//申请进件
		applyLeshua(data){
			// console.log(this.common.request(data))
			this.$http.post("/merchant/applyLeshua",this.common.request(data)).then((res)=>{
				if(res.data.body.status.statusCode == "0"){
					this.$Message.success("申请成功");
				}else{
					this.$Message.error(res.data.body.status.errorDesc);
				}
			})
		},
		Submit(){
			this.msgData.merchantUuid=this.$store.state.user.merchantUuid;
			this.applyLeshua(this.msgData)
		},
		update(){
			this.msgData.merchantUuid=this.$store.state.user.merchantUuid;
			
			console.log(this.msgData)
			
			for(var Key in this.msgData){
				
				
				if(this.msgData[Key] ==""){
					console.log(Key)
					if(Key !="refusalReason" && Key !="rejectReasonType"){
						this.$Message.success(Key+"请填写完整");
						return;
					}
					
				}
			}
			
			
			
			this.$http.post("/merchant/updateLeshua",this.common.request(this.msgData)).then((res)=>{
				if(res.data.body.status.statusCode == "0"){
					this.$Message.success("更新成功");
				}else{
					this.$Message.error(res.data.body.status.errorDesc);
				}
			})
		},
		initData(e){
			this.msgData=e;
			this.init.merchantType=this.msgData.merchantType-1;
			this.init.typeData=this.msgData.accountType-1;
			this.upImg.img[0]=e.idCardFrontPicUrl;
			this.upImg.img2[0]=e.idCardBackPicUrl;
			this.upImg.img3[0]=e.licensePicUrl;
			this.upImg.img4[0]=e.bankCardFrontPicUrl;
			this.upImg.img5[0]=e.insidePicUrl;
			this.upImg.img6[0]=e.doorPicUrl;
			this.upImg.img7[0]=e.cashierDeskPicUrl;
			this.upImg.img8[0]=e.nonLegSettleAuthPicUrl;
			this.upImg.img9[0]=e.nonLegIdcardFrontPicUrl;
			this.upImg.img10[0]=e.nonLegIdcardBackPicUrl;
			
			this.init.province=e.provinceCode;
			
			this.leshuaArea(2,e.provinceCode);
			this.init.city=e.cityCode
			
			this.leshuaArea(3,e.cityCode);
			this.init.area=e.areaCode
			
			if(e.merchantType !=1){
				this.isbusiness=true;
			}
			
			this.init.mccCate1=e.mccCate1
			this.searchMccCate(2,e.mccCate1);
			this.init.mccCate2=e.mccCate2
			
			this.searchMccCate(3,e.mccCate2);
			this.init.mccCate3=e.mccCate3
			this.searchMccCate(4,e.mccCate3);
			this.init.mccCate4=e.mccCate4
			
			this.init.unionProvince=e.unionProvince;
			this.leshuaArea(2,e.unionProvince,1);
			this.init.unionCity=e.unionCity;
			
			this.init.legalFlag=e.legalFlag;
			
			setTimeout(()=>{
				var a,n;
				for(var i=0;i<this.searchUnionPayData.searchUnionPay.length;i++){
					if(this.searchUnionPayData.searchUnionPay[i].areaCode ==e.unionProvince){
						a=this.searchUnionPayData.searchUnionPay[i].areaName
					}
				}
				for(var i=0;i<this.searchUnionPayData.searchUnionPay2.length;i++){
					if(this.searchUnionPayData.searchUnionPay2[i].areaCode ==e.unionCity){
						n=this.searchUnionPayData.searchUnionPay2[i].areaName
					}
				}
				
				this.searchUnionPay(a,n);
				this.init.unionPay=e.unionPay;
			},2000);
			
			
			
			// console.log(e.unionPay)
			
		},
		//设置初始化的值
		setMsgData(){
			this.msgData.legalFlag="";
			this.msgData.mccCode="";
			this.msgData.merchantName="";
			this.msgData.licenseFullName="";
			this.msgData.merchantType="";
			this.msgData.legalName="";
			this.msgData.idCardNo="";
			this.msgData.idCardFrontPic="";
			this.msgData.idCardBackPic="";
			this.msgData.idCardFrontPicUrl="";
			this.msgData.idCardBackPicUrl="";
			this.msgData.idCardStart="";
			this.msgData.idCardEnd="";
			this.msgData.name="";
			this.msgData.mobile="";
			this.msgData.province="";
			this.msgData.city="";
			this.msgData.area="";
			this.msgData.address="";
			this.msgData.provinceCode="";
			this.msgData.cityCode="";
			this.msgData.areaCode="";
			this.msgData.license="";
			this.msgData.licenseFullName="";
			this.msgData.licenseAddress="";
			this.msgData.licenseStart="";
			this.msgData.licenseEnd="";
			this.msgData.licensePic="";
			this.msgData.licensePicUrl="";
			this.msgData.accountType="";
			this.msgData.unionPay="";
			this.msgData.bankCardNo="";
			this.msgData.bankCardFrontPic="";
			this.msgData.bankCardFrontPicUrl="";
			this.msgData.holder="";
			this.msgData.insidePic="";
			this.msgData.doorPic="";
			this.msgData.cashierDeskPic="";
			this.msgData.insidePicUrl="";
			this.msgData.doorPicUrl="";
			this.msgData.cashierDeskPicUrl="";
			this.msgData.merchantUuid=this.$store.state.user.merchantUuid;
			
			this.msgData.mccCate1="";
			this.msgData.mccCate2="";
			this.msgData.mccCate3="";
			this.msgData.mccCate4="";
			
			this.msgData.unionProvince="";
			this.msgData.unionCity="";
			
			this.nonLegSettleAuthPic="";
			this.nonLegIdcardFrontPic="";
			this.nonLegIdcardBackPic="";
			this.nonLegSettleAuthPicUrl="";
			this.nonLegIdcardFrontPicUrl="";
			this.nonLegIdcardBackPicUrl="";

			
		},
		downloadBook(index){
			window.open(this.booK[index])
		}
       
    },
	mounted() {
		this.isType()
		this.setMsgData();
		this.searchMccCate(1);
		this.leshuaArea(1);
		this.leshuaArea(1,false,1);
	}
    
};
</script>


<style lang="less">
	.ivu-card{
		margin-bottom: 10px;
	}
	.inpBox{
		margin-left: 30px;
		div{
			margin-bottom: 10px;
			
			span{
				margin-right: 10px;
			}
		}
	}
	
	.inpBox .ivu-btn-circle span{
		margin-right: 0px;
	}
	
	.demo-upload-list{
	        display: inline-block;
	        width: 60px;
	        height: 60px;
	        text-align: center;
	        line-height: 60px;
	        border: 1px solid transparent;
	        border-radius: 4px;
	        overflow: hidden;
	        background: #fff;
	        position: relative;
	        box-shadow: 0 1px 1px rgba(0,0,0,.2);
	        margin-right: 4px;
	    }
	    .demo-upload-list img{
	        width: 100%;
	        height: 100%;
	    }
	    .demo-upload-list-cover{
	        display: none;
	        position: absolute;
	        top: 0;
	        bottom: 0;
	        left: 0;
	        right: 0;
	        background: rgba(0,0,0,.6);
	    }
	    .demo-upload-list:hover .demo-upload-list-cover{
	        display: block;
	    }
	    .demo-upload-list-cover i{
	        color: #fff;
	        font-size: 20px;
	        cursor: pointer;
	        margin: 0 2px;
	    }
	
</style>